# -*- coding: utf-8 -*-
"""
一个整数可以被分解为多个整数的乘积，为给定整数n,找出所有可能的分解。
"""
from typing import Sequence
import copy


class Solution:
    def run(self, n: int):
        def _recur_run(num, tmp_ret: Sequence[int], ret_list: Sequence[Sequence[int]]):
            if num == 1:
                if 1 not in tmp_ret:
                    tmp_ret.append(1)
                ret_list.append(tmp_ret)
                return
            for i in range(1, num + 1):
                if i == 1 and 1 in tmp_ret:
                    continue
                new_tmp_ret = copy.deepcopy(tmp_ret)
                new_tmp_ret.append(i)

                if num % i != 0:
                    continue

                _recur_run(num // i, new_tmp_ret, ret_list)
        ret = []
        _recur_run(n,[],ret)

        print(ret)

if __name__ == "__main__":
    Solution().run(10)
